package com.my_musc_service.controller;

import com.my_musc_service.common.R;
import com.my_musc_service.entity.SharedSong;
import com.my_musc_service.entity.SharedSongList;
import com.my_musc_service.service.SharedSongListService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (SharedSongList)表控制层
 *
 * @author A.Dun
 * @since 2021-08-17 14:14:38
 * @description 分享歌单相关
 */
@RestController
@RequestMapping("sharedSongList")
public class SharedSongListController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private SharedSongListService sharedSongListService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public SharedSongList selectOne(Integer id) {
        return this.sharedSongListService.queryById(id);
    }

    /**
     * 添加分享歌单
     * @param sharedSongList
     * @return
     */
    @PostMapping("add")
    public R addSharedSongList(@RequestBody SharedSongList sharedSongList){
        Boolean flag = sharedSongListService.insert(sharedSongList);
        return isOk(flag);
    }

    @PutMapping("addClickCount")
    public R addClickCount(@RequestBody SharedSongList sharedSongList){
        Boolean flag=sharedSongListService.addClickCount(sharedSongList);
        return isOk(flag);
    }

    @PutMapping("delClickCount")
    public R delClickCount(@RequestBody SharedSongList sharedSongList){
        Boolean flag=sharedSongListService.delClickCount(sharedSongList);
        return isOk(flag);
    }

}
